package com.smart.lib.service;

import com.smart.lib.entity.EchartData;
import com.smart.lib.mapper.EchartsMapper;
import com.smart.lib.util.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 数据可视化实现层
 * */
@Service
public class EchartsService {
    @Autowired
    EchartsMapper echartsMapper;

    /**
     * 查询大分类及其所有子分类的图书总数
     * */
    public Response selectParentCategoryWithChildrenBookCount(){
        return new Response(200,"查询成功",echartsMapper.selectParentCategoryWithChildrenBookCount());
    }

    /**
     * 本周每日借阅和归还统计
     * */
    public Response selectCurrentWeekData(){
        return new Response(200,"查询成功",echartsMapper.selectCurrentWeekData());
    }

    /**
     * 本月每日借阅和归还统计
     * */
    public Response selectCurrentMonthData(){
        return new Response(200,"查询成功",echartsMapper.selectCurrentMonthData());
    }

    /**
     * 本年每日借阅和归还统计
     * */
    public Response selectCurrentYearData(){
        return new Response(200,"查询成功",echartsMapper.selectCurrentYearData());
    }

    /**
     * 热门图书借阅排行
     * */
    public Response selectTop5BorrowedBooks(){
        return new Response(200,"查询成功",echartsMapper.selectTop5BorrowedBooks());
    }
}
